<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>创建测验</title>
		<link href="../../css/mui.min.css" rel="stylesheet"/>
		<link rel="stylesheet" type="text/css" href="../../css/mui.picker.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/base.css"/>
		<!--	<link rel="stylesheet" type="text/css" href="../../css/mui.min.css">-->
		<style>
			.base_right_item {
				color: white;
			}
			.right_aligned_input {
				text-align: right;
			}
			.right_aligned_div {
				float: right;
				width: 200px
			}
			.mui-checkbox input[type=checkbox]:checked:before, .mui-radio input[type=radio]:checked:before {
				color: #18b4ed;
			}
			.yesorno1 {
		
				height: 50px;
			}
			.yesorno1 .yesorno-radio {
				font-size: 14px;
				margin-top: 10px;
				display: inline-block;
			}
			.yesorno1 .mui-radio input[type=radio]:before {
				font-size: 22px;
			}
		
			.yesorno1 .mui-radio label {
				margin-left: 15px;
			}
			.yesorno1 .mui-radio input[type=radio]:checked:before {
				color: #18b4ed;
			}
		</style>
	</head>
	<body  >
		<div class="base_style_color" id='BarAppearance' style="height: 22px;width: 100%; position:fixed; left: 0px;top:0px;"></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar" style="position: fixed;left: 0px;top: 20px;">
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span>创建测验</span>
			<a class="base_right_item" href="#" onclick="addexam()"> 提交 </a>
		</div>
		<div class="newcheckrecord " style="padding-top: 60px;">
			<form class="mui-input-group font14 base_grey">
				<div class="mui-input-row">
					<label class="base_grey">测验名称</label>
					<input id="name" class="right_aligned_input base_content_font base_dark_grey" type="type" placeholder="测验名称" >
				</div>
				<div class="mui-input-row">
					<label class="base_grey">总分数</label>
					<input id="name" class="right_aligned_input base_content_font base_dark_grey" type="type" placeholder="总分数" >
				</div>
				<div class="mui-input-row">
					<label class="base_grey">通过分数</label>
					<input id="name" class="right_aligned_input base_content_font base_dark_grey" type="type" placeholder="通过分数" maxlength="3">
				</div>
				<div class="mui-input-row">
					<label class="base_grey">时限</label>
					<input id="name" class="right_aligned_input base_content_font base_dark_grey" type="type" placeholder="时限" maxlength="15">
				</div>
				<div class="mui-input-row" onClick="SelectExam()">
					<label>选择试卷:</label>
					<span class="stuname mui-navigate-right span_wight " id="exam_id" ></span>
				</div>
				<div class="mui-input-row line_heigt_px" id="starttime">
					<label>开始时间:</label>
					<input id="stime" class="right_aligned_input base_content_font base_dark_grey" readonly>
				</div>
				<div class="mui-input-row line_heigt_px" id="endtime">
					<label>结束时间:</label>
					<input id="etime" class="right_aligned_input base_content_font base_dark_grey" readonly>
				</div>
				<div class="mui-input-row">
					<label>考试次数:</label>
					<input id="name" class="right_aligned_input base_content_font base_dark_grey" type="type" placeholder="请填写考试次数" maxlength="3">
				</div>
				<div class="mui-input-row ">
					<label class="base_grey">显示答案</label>
					<div class="yesorno1 right">
						<div class="mui-input-row mui-radio yesorno-radio">
							<input name="radio1" type="radio"  value='1'>
							<label style="width: 40px;line-height:0.9;">是</label>
						</div>
						<div class="mui-input-row mui-radio yesorno-radio" >
							<input name="radio1" type="radio" value='0'>
							<label  style="width: 40px;line-height:0.9;">否</label>
						</div>
					</div>
				</div>
			</form>
		</div>
		<script src="../../script/mui.min.js"></script>
		<script src="../../script/common.js"></script>
		<script type="text/javascript" src="../../script/api.js"></script>
		<script type="text/javascript" src="../../script/mui.picker.min.js"></script>
		<script src="../../script/jquery.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="../../script/requestTool.js"></script>
		<script>
			var eid = '';
			var isexam='';//是否显示答案
			apiready = function() {
				setupMuiDatePicker();
				yesornoClick();
				//接收试卷id
				api.addEventListener({
					name : 'selectExamNotifi'
				}, function(ret, err) {
					if (ret.value) {
						var ename = ret.value.examname;
						eid = ret.value.id;
						$('#exam_id').text(ename);
					}
				});
			}
			function backClick() {
				api.closeWin();
			}
			//是否阅卷
		function yesornoClick() {
			$('.yesorno1').click(function() {
				var sfyyjyScore = $("input[type='radio']:checked").val();
				
				isexam = sfyyjyScore;
			});
		}

			function setupMuiDatePicker() {
				var fullYear = new Date().getFullYear() + 4;
				$('#startdate').attr('data-options', '{"type":"date","beginYear":1900,"endYear":' + fullYear + '}');
				(function($mui) {
					$("#starttime").click(function() {
						var optionsJson = this.getAttribute('data-options') || '{}';
						var options = JSON.parse(optionsJson);
						var picker = new $mui.DtPicker(options);
						picker.show(function(rs) {
							$('#stime').val(rs.text);
							picker.dispose();
						});
					});
				})(mui);
				$('#endtime').attr('data-options', '{"type":"date","beginYear":1900,"endYear":' + fullYear + '}');
				(function($mui) {
					$("#endtime").click(function() {
						var optionsJson = this.getAttribute('data-options') || '{}';
						var options = JSON.parse(optionsJson);
						var picker = new $mui.DtPicker(options);
						picker.show(function(rs) {
							$('#etime').val(rs.text);
							picker.dispose();
						});
					});
				})(mui);
			}

			/**
			 *上传数据
			 *   Uid：用户uid
			 school_id :  学校id
			 report  :  总结报告内容
			 type : 微博类型 1.图片，0：无图片
			 type_data :  图片上传后的返回地址
			 studentid：巡视学生id（例如：2025,2028）
			 time  ：巡视时间
			 corpname  ：企业名称
			 form   ：巡视形式(1：实地考察2：电话回访3：网络回访4：网络回访5：其他)
			 *  */
			function Upload_data(report, imageurl) {
				params = {
					uid : $api.getStorage('cfnetppuid'),
					jid : $api.getStorage('cfnetppjid'),
					report : report,
					imageurl : imageurl,
					studentid : stuid.substring(1, stuid.length),
					corpid : cid,
					form : form_text
				};
				cfnetppPOST(urlAddpatro, params, false, function(data, status) {
					api.hideProgress();
					if (status == 'success') {
						if (data.status == 1) {
							api.sendEvent({
								name : 'addpatroNotifi'
							});
							api.toast({
								msg : '添加成功'
							});
							api.closeWin();
						} else {
							$('.base_right_item').show();
							api.toast({
								msg : '添加失败'
							});
						}
					} else {
						$('.base_right_item').show();
						api.toast({
							msg : '添加失败'
						});
					}
				});
			}

			/**
			 *巡视企业
			 *   */
			function SelectExam() {
				//	 	alert("*巡视企业");
				api.openWin({useWKWebView:true,
					name : 'TeacherSelectExamWindow',
					url : 'TeacherSelectExamWindow.html',
				});
			}
		</script>
	</body>
</html>
